home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
TEMP
/
GNU
/
bison
/
ValueType
< prev
next >
Wrap
Text File
|
1995-06-28
|
752b
|
23 lines
Value Type
Previous: <Semantics=>Semantics> * Next: <Multiple Types=>MultipleTy> * Up: <Semantics=>Semantics>
#Wrap on
{fH4}Data Types of Semantic Values{f}
In a simple program it may be sufficient to use the same data type for
the semantic values of all language constructs. This was true in the
RPN and infix calculator examples (\*Note <RPN Calc=>RPNCalc>: Reverse Polish Notation Calculator).
Bison's default is to use type {fCode}int{f} for all semantic values. To
specify some other type, define {fCode}YYSTYPE{f} as a macro, like this:
#Wrap off
#fCode
\#define YYSTYPE double
#f
#Wrap on
This macro definition must go in the C declarations section of the grammar
file (\*Note <Grammar Outline=>GrammarOut>: Outline of a Bison Grammar).